package pk.nak.data;

import java.util.ArrayList;

public class EatOutPriceComparator {
	
	ArrayList<EatOutMenuItemPrices> items;
	
	public EatOutPriceComparator() {
		super();
		this.items = new ArrayList<EatOutMenuItemPrices>();
	}
	
	public EatOutMenuItemPrices getEatOutMenuItemPrices(String itemName){
		for ( int i = 0 ; i < this.items.size() ; i ++ ){
			if ( this.items.get(i).getEatoutName().compareTo(itemName) == 0 ){
				return this.items.get(i);
			}
		}
		return null;
	}
	
	public void addPriceGroup(String itemName, String eatoutType, double price, EatOut eo){
		for ( int i = 0 ; i < this.items.size() ; i ++ ){
			if ( this.items.get(i).getEatoutName().compareTo(itemName) == 0 ){
				this.items.get(i).addPriceGroup(eo, price);
				return;
			}
		}
		EatOutMenuItemPrices eomip = new EatOutMenuItemPrices(itemName, eatoutType);
		eomip.addPriceGroup(eo, price);
		this.items.add(eomip);
		return;
	}
}
